import React, { Component } from 'react'
import PropTypes from 'prop-types'
import './index.css'

import Item from '../Item/index'

export default class List extends Component {

  static propTypes={
    todos:PropTypes.array.isRequired,
    changeTodo:PropTypes.func.isRequired,
    deleteItem:PropTypes.func.isRequired,
  }

  render() {
    const { todos,changeTodo,deleteItem } = this.props
    return (
      <div className='list'>
        {
          todos.map(i=>{
            return <Item {...i} key={i.id} changeTodo={changeTodo} deleteItem={deleteItem}/>
          })
        }
        
        
      </div>
    )
  }
}
